package com.ringtheweb.serviceprovider.weather.core;

import java.net.URL;
import java.util.List;

import com.ringtheweb.serviceprovider.weather.model.Location;
import com.ringtheweb.serviceprovider.weather.model.LocationType;
import com.ringtheweb.serviceprovider.weather.model.Transition;



public class StateToCityRetriever extends AbstractHttpLocationRetriever {
	
	public StateToCityRetriever() {
		super("//div[@id='yw-regionalloc']/ul/li/a");
	}

	public Transition<LocationType> getTransition() {
		return new Transition<LocationType>(LocationType.STATE,LocationType.CITY);
	}
	
	public static void main(String[] args) throws Throwable {
		StateToCityRetriever w = new StateToCityRetriever();
		List<Location> locations = w.retrieveChildren(new Location("Alabama",LocationType.STATE,new URL("http://weather.yahoo.com/regional/USAL.html")));
		
		for (Location location: locations) {
			System.out.println(location);
		}
	}

}
